<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>设施列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link href="//unpkg.com/layui@2.9.14/dist/css/layui.css" rel="stylesheet">
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script src="./js/jquery.js"></script>
    <script src="./js/common/ajaxUse.js"></script>
    <script src="js/common/FilterExampleQuery.js"></script>
</head>

<body>
<div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">设施管理</a>
            <a>
              <cite>设施列表</cite></a>
          </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <div class="layui-card-body FilterParent">

                        <div class="layui-inline layui-show-xs-block">
                            <button class="layui-btn"  lay-submit="" lay-filter="search"><i class="layui-icon" onclick="submit('/search/exampleQuery',NotExampleQuery(7))">重置列表</i></button>
                            <button class="layui-btn"  lay-submit="" lay-filter="search"><i class="layui-icon" onclick="addFilter()">新增筛选</i></button>
                            <button class="layui-btn"  lay-submit="" lay-filter="search"><i class="layui-icon" onclick="submit('/search/exampleQuery',getExamples(7))">&#xe615;</i></button>
                        </div>

                        <div class="layui-collapse Filter" lay-filter="test">
                            <div class="layui-colla-item">
                                <h2 class="layui-colla-title">条件筛选
                                    <i class="layui-icon layui-colla-icon">
                                    </i>
                                    <a title="删除" onclick="deleteFilter(this.parentElement.parentElement.parentElement)" href="javascript:;">
                                        <i class="layui-icon">&#xe640;</i></a></h2>
                                <div class="layui-colla-content">
                                    <form class="layui-form" action="">
                                        <div class="layui-form-item" id="name" style="display: inline-block; margin-right: 10px;">
                                            <label for="iName" class="layui-form-label">
                                                设施名称
                                            </label>
                                            <div class="layui-input-inline">
                                                <input type="text" id="iName" name="iName" autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item" style="display: inline-block; margin-right: 10px;">
                                            <label for="iType" class="layui-form-label">
                                                设施种类
                                            </label>
                                            <div class="layui-input-inline">
                                                <input type="text" id="iType" name="iType" autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item" style="display: inline-block; margin-right: 10px;">
                                            <label for="iLocation" class="layui-form-label">
                                                设施位置
                                            </label>
                                            <div class="layui-input-inline">
                                                <input type="text" id="iLocation" name="iLocation" autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item" style="display: inline-block; margin-right: 10px;">
                                            <label for="iStaffId" class="layui-form-label">
                                                购买员工编号
                                            </label>
                                            <div class="layui-input-inline">
                                                <input type="number" name="iStaffId" id="iStaffId" autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item" style="display: inline-block; margin-right: 10px;">
                                            <label for="iFinanceId" class="layui-form-label">
                                                财务编号
                                            </label>
                                            <div class="layui-input-inline">
                                                <input type="number" name="iFinanceId" id="iFinanceId" autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item" style="display: inline-block; margin-right: 10px;">
                                            <label for="iInstallDate" class="layui-form-label">
                                                安装日期
                                            </label>
                                            <div class="layui-input-inline">
                                                <input type="date" name="iInstallDate" id="iInstallDate" autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item" style="display: inline-block; margin-right: 10px;">
                                            <label for="iStatus" class="layui-form-label">
                                                设施状态
                                            </label>
                                            <div class="layui-input-inline" id="iStatus">
                                                <input type="radio" name="iStatus" value=0 title="未安装">
                                                <input type="radio" name="iStatus" value=1 title="正在使用">
                                                <input type="radio" name="iStatus" value=2 title="正在维修">
                                                <input type="radio" name="iStatus" value=3 title="已停用">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <div class="layui-input-block">
                                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                            </div>
                                        </div>
                                    </form>

                                </div>
                            </div>
                        </div>

                    </div>
                    <div id="FilterDisplayContainer"></div>
                    <div class="layui-card-header">
                        <button class="layui-btn" onclick="xadmin.open('添加设施','infrastructure-add.html',800,600)">
                            <i class="layui-icon"></i>
                            添加</button></div>
                </div>
                <div class="layui-card-body layui-table-body layui-table-main">
                    <table class="layui-table layui-form data-list" id="editableTable">
                        <thead>
                        <tr>
                            <th>
                                <input type="checkbox" lay-filter="checkall" name="" lay-skin="primary">
                            </th>
                            <th>设施编号</th>
                            <th>设施名称</th>
                            <th>设施种类</th>
                            <th>设施价格</th>
                            <th>安装日期</th>
                            <th>设施具体位置</th>
                            <th>检修固定时间(天)</th>
                            <th>状态</th>
                            <th>购买人员</th>
                            <th>购入财务记录</th>
                            <th>备注</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                    </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>

<script>
    submit('/search/exampleQuery',NotExampleQuery(7))
    function doAction (data) {
        layer.open({
            type: 2,
            title: '修改数据', //ifrem的标题
            maxmin: true, //最小化
            shadeClose: true, //点击遮罩关闭层
            area: ['80%', '80%'], //大小
            content: 'infrastructure-edit.html',//打开的url
            success: function (layero, index) {
                var body=layer.getChildFrame('body',index);
                body.contents().find('#iId').val(data.childNodes.item(3).innerHTML);
                body.contents().find('#iName').val(data.childNodes.item(5).innerHTML);
                body.contents().find('#iType').val(data.childNodes.item(7).innerHTML);
                body.contents().find('#iPrice').val(data.childNodes.item(9).innerHTML);
                body.contents().find('#iInstallDate').val(data.childNodes.item(11).innerHTML);
                body.contents().find('#iLocation').val(data.childNodes.item(13).innerHTML);
                body.contents().find('#iOverhaulTime').val(data.childNodes.item(15).innerHTML);
                if(data.childNodes.item(17).innerHTML === '未安装'){
                    select = 'dd[lay-value=\'1\']'
                }else  if(data.childNodes.item(17).innerHTML === '正在使用')
                {
                    select = 'dd[lay-value=\'2\']'
                }
                else  if(data.childNodes.item(17).innerHTML === '正在维修')
                {
                    select = 'dd[lay-value=\'3\']'
                }else{
                    select = 'dd[lay-value=\'4\']'
                }
                body.contents().find('#iStatus').siblings("div.layui-form-select").find('dl').find(select).click();
                // body.contents().find('#iStatus').val(data.childNodes.item(17).innerHTML);
                body.contents().find('#iStaffId').val(data.childNodes.item(19).innerHTML);
                body.contents().find('#iFinanceId').val(data.childNodes.item(21).innerHTML);
                body.contents().find('#iNotes').val(data.childNodes.item(23).innerHTML);

            }
        })
    }
    layui.use(['laydate', 'form'],
        function() {
            var laydate = layui.laydate;
            //执行一个laydate实例
            laydate.render({
                elem: '#start' //指定元素
            });
            //执行一个laydate实例
            laydate.render({
                elem: '#end' //指定元素
            });
        });

    /*用户-删除*/

    function member_del(obj, id) {
        id = obj.parentElement.parentElement.childNodes.item(3).textContent;
        layer.confirm('确认要删除吗？',function(index){
            submit("/Infrastructure/deleteInfrastructure",JSON.stringify({iId:id}))
            //发异步删除数据
            $(obj).parents("tr").remove();
        });
    }


</script>
</html>